package org.info.stock.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.client.RestHighLevelClient;
import org.info.stock.entity.LatestStocks;
import org.info.stock.service.StockSaveService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

@Slf4j
@Service
public class StockSaveServiceImpl implements StockSaveService {

    @Resource
    private RestHighLevelClient client;

    /**
     * 将数据保存到ES
     * BulkRequest bulkRequest, RequestOptions options
     */
    @Override
    public boolean stockStatusUp(List<LatestStocks> skuEsModels) throws IOException {
        // 1.给ES建立一个索引 product
        BulkRequest bulkRequest = new BulkRequest();
        return false;
    }
}
